import com.kuang.pojo.Books;
import com.kuang.service.BookService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class Mytest {
  @Test
  public void test(){
    ApplicationContext context = new FileSystemXmlApplicationContext("src/main/resources/applicationContext.xml");
    BookService serviceImpl = (BookService) context.getBean("BookServiceImpl");
    for (Books books : serviceImpl.queryAllBook()){
      System.out.println(books);
    }
  }
  @Test
  public void ByName(){
    ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
    BookService serviceImpl = (BookService) context.getBean("BookServiceImpl");
    System.out.println(serviceImpl.queryBookName("MySQL"));

  }
  }

